import { defineStore } from "pinia";
import { WatermarkState } from "../components/data";

export const useWatermarkState = defineStore("WatermarkState", {
    state: (): WatermarkState => ({
        input: "",
        output: "",
        page: "",
        op: "add",
        type: "text",
        text: "",
        font_family: "msyh.ttc",
        font_size: 50,
        font_color: "#000000",
        font_opacity: 0.3,
        rotate: 45,
        num_lines: 1,
        multiple_mode: false,
        x_offset: 0,
        y_offset: 0,
        word_spacing: 1,
        line_spacing: 1,
        remove_method: "type",
        step: "1",
        wm_index: "",
        wm_text: "",
        lines: 0,
        wm_path: "",
        scale: 1,
        mask_type: 'annot',
        unit: 'pt',
        width: 0,
        height: 0,
        annot_page: 1,
        mask_color: '#FFFFFF',
        mask_opacity: 1,
        layer: "bottom",
    }),
    getters: {

    },
    actions: {
        resetState() {
            this.$patch({
                input: "",
                output: "",
                page: "",
                op: "add",
                type: "text",
                text: "",
                font_family: "msyh.ttc",
                font_size: 50,
                font_color: "#000000",
                font_opacity: 0.3,
                rotate: 45,
                num_lines: 1,
                multiple_mode: false,
                x_offset: 0,
                y_offset: 0,
                word_spacing: 1,
                line_spacing: 1,
                remove_method: "type",
                step: "1",
                wm_index: "",
                wm_text: "",
                lines: 0,
                wm_path: "",
                scale: 1,
                mask_type: 'annot',
                unit: 'pt',
                width: 0,
                height: 0,
                annot_page: 1,
                mask_color: '#FFFFFF',
                mask_opacity: 1,
                layer: "bottom",
            })
        },
    }
})